#define _CRT_SECURE_NO_WARNINGS 1

#include "RBTree.h"

int main()
{
	using my_rb_tree::RBTree;
	//int a[] = { 16, 3, 7, 11, 9, 26, 18, 14, 15 };
	int a[] = { 4, 2, 6, 1, 3, 5, 15, 7, 16, 14 };
	RBTree<int, int> t;
	int i = 1;
	for (const auto& n : a)
	{
		t.Insert(make_pair(n, i++));
	}
	//t.Insert(make_pair(5, 5));
	////t.Insert(make_pair(4, 4));
	//t.Insert(make_pair(6, 6));
	//t.Insert(make_pair(7, 7));
	//t.midorder();
	//int x = 100000000;
	//srand(time(NULL));
	//for (int i = 0; i <= x; ++i)
	//{
	//	t.Insert(make_pair(rand() % (x * 10), 0));
	//}

	//cout<<t.IsBalanceTree()<<endl;
	auto it = t.Find(14);
	if (it)
		cout << it->_data.first << ":" << it->_data.second << endl;
	return 0;
}